/**
 * 各对象特有的属性放在构造函数对象本身里
 * 执行相同操作操作的方法放到原型上
 */

function Person(name, age) {
  this.name = name
  this.age = age
}

Person.prototype.eating = function () {
  console.log(this.name + ' is eating')
}
Person.prototype.running = function () {
  console.log(this.name + ' is running')
}
Person.prototype.arrow = () => {
  console.log(this)
}
p1 = new Person('lijing', 14)
p2 = new Person('dd', 20)
p1.eating()
p2.eating()
p1.running()
p2.running()

p1.arrow()//箭头函数不会进行隐式绑定，浏览器中是window
